<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
    </head>
    <body>
        <script>
            //设置延时执行
            var timeOutId = setTimeout(function(){
                console.log("jereh");
            },2000);     //延时2s后控制台打印jereh
            //使用延时器清除延时
            setTimeout(function(){
                clearTimeout(timeOutId);//在clearTimeout方法传入变量timeOutId
            },5000);//5s后清除延时器


</script>
</body>

</html>